<template>
  <div>
    <div class="card">您好！{{data.user?.name}}欢迎使用本系统</div>
  </div>
  <div class="card">
    <el-button type="primary">按钮</el-button>
    <el-button type="danger">按钮</el-button>
    <el-button type="warning">按钮</el-button>
    <el-button type="info">按钮</el-button>
    <el-button type="success">按钮</el-button>
  </div>
  <div style="display: flex">
    <div class="card" style="flex: 50%; height: 350px">
      <div style="font-weight: bold; font-size: 18px; padding: 10px 0 30px 10px">系统公告</div>
      <el-timeline style="max-width: 600px">
        <el-timeline-item
            v-for="(item, index) in data.noticeData"
            :key="index"
            :timestamp="item.time"
        >
          {{ item.content }}
        </el-timeline-item>
      </el-timeline>
    </div>
    <div style="flex: 50%"></div>
  </div>
</template>
<script setup>

import {reactive} from "vue";
import {ElMessage} from "element-plus";
import request from "@/utils/request.js";

const data = reactive({
  user:JSON.parse(localStorage.getItem('xm-user') || '{}'),
  noticeData:{}
})

const loadNotice = () => {
  request.get('notice/selectAll').then(res=>{
    if (res.code === '200') {
      data.noticeData = res.data
    } else {
      ElMessage.error(res.msg)
    }
  })
}
loadNotice()
</script>